package com.SHA1604.tiger.fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.SHA1604.tiger.R;
import com.SHA1604.tiger.adapter.MeAdapter;
import com.SHA1604.tiger.base.BaseFragment;
import com.SHA1604.tiger.view.Me_Header;
import com.SHA1604.tiger.view.Me_Tails;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * ***********************************************************
 * author: jie
 * time: 2016/7/27 09:02
 * name:
 * overview:Build.VERSION.SDK_INT:版本号
 * usage:
 * *************************************************************
 */
public class MeFragment extends BaseFragment{
    private ListView me_lv;
    private List<HashMap<String,Object>> mDatas;
    private MeAdapter mAdapter;

    @Override
    protected View loadXml(LayoutInflater inflater, ViewGroup container) {
        return inflater.inflate(R.layout.fragment_me,container,false);
    }

    @Override
    protected void initView(View view) {
        me_lv = (ListView) view.findViewById(R.id.me_lv);
        LinearLayout hearderViewLayout = (LinearLayout)
                LayoutInflater.from(mActivity).inflate(R.layout.view_me_header,null);
        me_lv.addHeaderView(hearderViewLayout);
        LinearLayout footViewLayout = (LinearLayout)
                LayoutInflater.from(mActivity).inflate(R.layout.view_me_tails,null);
        me_lv.addFooterView(footViewLayout);
    }

    @Override
    protected void initData() {
        mDatas = new ArrayList<>();
        HashMap<String, Object> map1 = new HashMap<String, Object>();
        map1.put("id",R.mipmap.shopping);
        map1.put("title", "购物车");
        mDatas.add(map1);
        HashMap<String, Object> map2 = new HashMap<String, Object>();
        map2.put("id", R.mipmap.icon_dingdan);
        map2.put("title", "我的订单");
        mDatas.add(map2);
        HashMap<String, Object> map3 = new HashMap<String, Object>();
        map3.put("id", R.mipmap.icon_qianbao);
        map3.put("title", "我的钱包");
        mDatas.add(map3);
        HashMap<String, Object> map4 = new HashMap<String, Object>();
        map4.put("id", R.mipmap.icon_shoucang);
        map4.put("title", "我的收藏");
        mDatas.add(map4);
        HashMap<String, Object> map5 = new HashMap<String, Object>();
        map5.put("id", R.mipmap.icon_shaiwu);
        map5.put("title", "我的晒物");
        mDatas.add(map5);
        HashMap<String, Object> map6 = new HashMap<String, Object>();
        map6.put("id", R.mipmap.icon_zan);
        map6.put("title", "我赞过的商品");
        mDatas.add(map6);
        HashMap<String, Object> map7 = new HashMap<String, Object>();
        map7.put("id", R.mipmap.icon_dizhi);
        map7.put("title", "收货地址");
        mDatas.add(map7);

        mAdapter = new MeAdapter(mActivity,mDatas);
        me_lv.setAdapter(mAdapter);
    }
}
